package com.ruoyi.wechat.api;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.wechat.domain.Comments;
import com.ruoyi.wechat.service.ICommentsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequestMapping("/wechat/comments")
public class WxCommentsController extends BaseController {
    @Autowired
    private ICommentsService commentsService;


    @GetMapping("/list")
    public TableDataInfo list(Comments comments)
    {
        List<Comments> list = commentsService.selectCommentsList(comments);
        return getDataTable(list);
    }

    @PostMapping
    public AjaxResult add(@RequestBody Comments comments)
    {
        return toAjax(commentsService.insertComments(comments));
    }

}
